﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Scrum.Net.Interfaces;
using Scrum.Net.Utilities;

namespace Scrum.Net.Classes
{
    public class Project : ObservableObject, IProject
    {
        private string _name;
        private string _description;
        private DateTime _start;
        private DateTime _end;
        private readonly ObservableCollection<IUser> _users;
        private readonly IList<ISprint> _sprints;
        private readonly IList<IProductStory> _backlog;

        public string Name
        {
            get { return _name; }
            set
            {
                _name = value;
                RaisePropertyChanged("Name");
            }
        }

        public DateTime Start
        {
            get { return _start; }
            set
            {
                _start = value;
                RaisePropertyChanged("Start");
            }
        }

        public DateTime End
        {
            get { return _end; }
            set
            {
                _end = value;
                RaisePropertyChanged("End");
            }
        }

        public string Description
        {
            get { return _description; }
            set
            {
                _description = value;
                RaisePropertyChanged("Description");
            }
        }

        public ObservableCollection<IUser> Users
        {
            get { return _users; }
        }

        public IList<ISprint> Sprints
        {
            get { return _sprints; }
        }

        public IList<IProductStory> Backlog
        {
            get { return _backlog; }
        }

        public Project(string name)
        {
            Name = name;

            _users = new ObservableCollection<IUser>();
            _sprints = new List<ISprint>();
            _backlog = new List<IProductStory>();

            //TypeInfo = GetType();
        }

        public IList<String> SaveProperties()
        {
            List<string> result = new List<string>
                                      {
                                          "Name=" + Name,
                                          "Description=" + Description,
                                          "Start=" + Start,
                                          "End=" + End
                                      };

            return result;
        }
    }
}